package com.proto;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 * <pre>
 * 声明 rpc 服务接口
 * 生成 Service01Grpc类、以及该类的方法
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.11.0)",
    comments = "Source: test01.proto")
public final class Service01Grpc {

  private Service01Grpc() {}

  public static final String SERVICE_NAME = "Service01";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @java.lang.Deprecated // Use {@link #getMethod01Method()} instead. 
  public static final io.grpc.MethodDescriptor<com.proto.Method01Request,
      com.proto.Method01Reply> METHOD_METHOD01 = getMethod01MethodHelper();

  private static volatile io.grpc.MethodDescriptor<com.proto.Method01Request,
      com.proto.Method01Reply> getMethod01Method;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<com.proto.Method01Request,
      com.proto.Method01Reply> getMethod01Method() {
    return getMethod01MethodHelper();
  }

  private static io.grpc.MethodDescriptor<com.proto.Method01Request,
      com.proto.Method01Reply> getMethod01MethodHelper() {
    io.grpc.MethodDescriptor<com.proto.Method01Request, com.proto.Method01Reply> getMethod01Method;
    if ((getMethod01Method = Service01Grpc.getMethod01Method) == null) {
      synchronized (Service01Grpc.class) {
        if ((getMethod01Method = Service01Grpc.getMethod01Method) == null) {
          Service01Grpc.getMethod01Method = getMethod01Method = 
              io.grpc.MethodDescriptor.<com.proto.Method01Request, com.proto.Method01Reply>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "Service01", "method01"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.proto.Method01Request.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.proto.Method01Reply.getDefaultInstance()))
                  .setSchemaDescriptor(new Service01MethodDescriptorSupplier("method01"))
                  .build();
          }
        }
     }
     return getMethod01Method;
  }
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @java.lang.Deprecated // Use {@link #getMethod02Method()} instead. 
  public static final io.grpc.MethodDescriptor<com.proto.Method02Request,
      com.proto.Method02Reply> METHOD_METHOD02 = getMethod02MethodHelper();

  private static volatile io.grpc.MethodDescriptor<com.proto.Method02Request,
      com.proto.Method02Reply> getMethod02Method;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<com.proto.Method02Request,
      com.proto.Method02Reply> getMethod02Method() {
    return getMethod02MethodHelper();
  }

  private static io.grpc.MethodDescriptor<com.proto.Method02Request,
      com.proto.Method02Reply> getMethod02MethodHelper() {
    io.grpc.MethodDescriptor<com.proto.Method02Request, com.proto.Method02Reply> getMethod02Method;
    if ((getMethod02Method = Service01Grpc.getMethod02Method) == null) {
      synchronized (Service01Grpc.class) {
        if ((getMethod02Method = Service01Grpc.getMethod02Method) == null) {
          Service01Grpc.getMethod02Method = getMethod02Method = 
              io.grpc.MethodDescriptor.<com.proto.Method02Request, com.proto.Method02Reply>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "Service01", "method02"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.proto.Method02Request.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.proto.Method02Reply.getDefaultInstance()))
                  .setSchemaDescriptor(new Service01MethodDescriptorSupplier("method02"))
                  .build();
          }
        }
     }
     return getMethod02Method;
  }

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static Service01Stub newStub(io.grpc.Channel channel) {
    return new Service01Stub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static Service01BlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new Service01BlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static Service01FutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new Service01FutureStub(channel);
  }

  /**
   * <pre>
   * 声明 rpc 服务接口
   * 生成 Service01Grpc类、以及该类的方法
   * </pre>
   */
  public static abstract class Service01ImplBase implements io.grpc.BindableService {

    /**
     * <pre>
     * Sends a greeting.
     * 生成method01方法(格式为"方法名 请求参数 返回参数")
     * </pre>
     */
    public void method01(com.proto.Method01Request request,
        io.grpc.stub.StreamObserver<com.proto.Method01Reply> responseObserver) {
      asyncUnimplementedUnaryCall(getMethod01MethodHelper(), responseObserver);
    }

    /**
     * <pre>
     * Sends a greeting.
     * 生成method02方法(格式为"方法名 请求参数 返回参数")
     * </pre>
     */
    public void method02(com.proto.Method02Request request,
        io.grpc.stub.StreamObserver<com.proto.Method02Reply> responseObserver) {
      asyncUnimplementedUnaryCall(getMethod02MethodHelper(), responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getMethod01MethodHelper(),
            asyncUnaryCall(
              new MethodHandlers<
                com.proto.Method01Request,
                com.proto.Method01Reply>(
                  this, METHODID_METHOD01)))
          .addMethod(
            getMethod02MethodHelper(),
            asyncUnaryCall(
              new MethodHandlers<
                com.proto.Method02Request,
                com.proto.Method02Reply>(
                  this, METHODID_METHOD02)))
          .build();
    }
  }

  /**
   * <pre>
   * 声明 rpc 服务接口
   * 生成 Service01Grpc类、以及该类的方法
   * </pre>
   */
  public static final class Service01Stub extends io.grpc.stub.AbstractStub<Service01Stub> {
    private Service01Stub(io.grpc.Channel channel) {
      super(channel);
    }

    private Service01Stub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected Service01Stub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new Service01Stub(channel, callOptions);
    }

    /**
     * <pre>
     * Sends a greeting.
     * 生成method01方法(格式为"方法名 请求参数 返回参数")
     * </pre>
     */
    public void method01(com.proto.Method01Request request,
        io.grpc.stub.StreamObserver<com.proto.Method01Reply> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getMethod01MethodHelper(), getCallOptions()), request, responseObserver);
    }

    /**
     * <pre>
     * Sends a greeting.
     * 生成method02方法(格式为"方法名 请求参数 返回参数")
     * </pre>
     */
    public void method02(com.proto.Method02Request request,
        io.grpc.stub.StreamObserver<com.proto.Method02Reply> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getMethod02MethodHelper(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   * <pre>
   * 声明 rpc 服务接口
   * 生成 Service01Grpc类、以及该类的方法
   * </pre>
   */
  public static final class Service01BlockingStub extends io.grpc.stub.AbstractStub<Service01BlockingStub> {
    private Service01BlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private Service01BlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected Service01BlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new Service01BlockingStub(channel, callOptions);
    }

    /**
     * <pre>
     * Sends a greeting.
     * 生成method01方法(格式为"方法名 请求参数 返回参数")
     * </pre>
     */
    public com.proto.Method01Reply method01(com.proto.Method01Request request) {
      return blockingUnaryCall(
          getChannel(), getMethod01MethodHelper(), getCallOptions(), request);
    }

    /**
     * <pre>
     * Sends a greeting.
     * 生成method02方法(格式为"方法名 请求参数 返回参数")
     * </pre>
     */
    public com.proto.Method02Reply method02(com.proto.Method02Request request) {
      return blockingUnaryCall(
          getChannel(), getMethod02MethodHelper(), getCallOptions(), request);
    }
  }

  /**
   * <pre>
   * 声明 rpc 服务接口
   * 生成 Service01Grpc类、以及该类的方法
   * </pre>
   */
  public static final class Service01FutureStub extends io.grpc.stub.AbstractStub<Service01FutureStub> {
    private Service01FutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private Service01FutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected Service01FutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new Service01FutureStub(channel, callOptions);
    }

    /**
     * <pre>
     * Sends a greeting.
     * 生成method01方法(格式为"方法名 请求参数 返回参数")
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.proto.Method01Reply> method01(
        com.proto.Method01Request request) {
      return futureUnaryCall(
          getChannel().newCall(getMethod01MethodHelper(), getCallOptions()), request);
    }

    /**
     * <pre>
     * Sends a greeting.
     * 生成method02方法(格式为"方法名 请求参数 返回参数")
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.proto.Method02Reply> method02(
        com.proto.Method02Request request) {
      return futureUnaryCall(
          getChannel().newCall(getMethod02MethodHelper(), getCallOptions()), request);
    }
  }

  private static final int METHODID_METHOD01 = 0;
  private static final int METHODID_METHOD02 = 1;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final Service01ImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(Service01ImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_METHOD01:
          serviceImpl.method01((com.proto.Method01Request) request,
              (io.grpc.stub.StreamObserver<com.proto.Method01Reply>) responseObserver);
          break;
        case METHODID_METHOD02:
          serviceImpl.method02((com.proto.Method02Request) request,
              (io.grpc.stub.StreamObserver<com.proto.Method02Reply>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class Service01BaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    Service01BaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.proto.Test01Proto.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("Service01");
    }
  }

  private static final class Service01FileDescriptorSupplier
      extends Service01BaseDescriptorSupplier {
    Service01FileDescriptorSupplier() {}
  }

  private static final class Service01MethodDescriptorSupplier
      extends Service01BaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    Service01MethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (Service01Grpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new Service01FileDescriptorSupplier())
              .addMethod(getMethod01MethodHelper())
              .addMethod(getMethod02MethodHelper())
              .build();
        }
      }
    }
    return result;
  }
}
